package negotiator

import (
	"github.com/bytedance/sonic"
)

const (
	MIME_JSON MIME = "application/json"
)

type jsonImpl struct{}

func (i *jsonImpl) Encode(v any) ([]byte, error) {
	return sonic.Marshal(v)
}

func (i *jsonImpl) Decode(data []byte, v any) error {
	return sonic.Unmarshal(data, v)
}

func (i *jsonImpl) ContentType() MIME {
	return MIME_JSON
}

func init() {
	Registry(&jsonImpl{})
	// fmt.Println("————————已注册json模块——————")
}
